﻿using System;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;

namespace Fotia.SqlClr
{
	public class FormatStringMax
	{
		[SqlFunction(DataAccess = DataAccessKind.None, IsDeterministic = true)]
		public static SqlString FormatStringMax0(SqlString format, SqlString arg0)
		{
			return format.IsNull ? SqlString.Null : string.Format(format.Value, arg0);
		}

		[SqlFunction(DataAccess = DataAccessKind.None, IsDeterministic = true)]
		public static SqlString FormatStringMax1(SqlString format, SqlString arg0, SqlString arg1)
		{
			return format.IsNull ? SqlString.Null : string.Format(format.Value, arg0, arg1);
		}

		[SqlFunction(DataAccess = DataAccessKind.None, IsDeterministic = true)]
		public static SqlString FormatStringMax2(SqlString format, SqlString arg0, SqlString arg1, SqlString arg2)
		{
			return format.IsNull ? SqlString.Null : string.Format(format.Value, arg0, arg1, arg2);
		}

		[SqlFunction(DataAccess = DataAccessKind.None, IsDeterministic = true)]
		public static SqlString FormatStringMax3(SqlString format, SqlString arg0, SqlString arg1, SqlString arg2, SqlString arg3)
		{
			return format.IsNull ? SqlString.Null : string.Format(format.Value, arg0, arg1, arg2, arg3);
		}
	}
}